<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/admin/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>在线考试后台登录页面</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<link rel="stylesheet" type="text/css" href="../css/login.css">

  </head>
  	 <script type="text/javascript"> 
			function changeValidateCode(obj) { 
			//获取当前的时间作为参数，无具体意义 
				var timenow = new Date().getTime(); 
			//每次请求需要一个不同的参数，否则可能会返回同样的验证码 
			//这和浏览器的缓存机制有关系，也可以把页面设置为不缓存，这样就不用这个参数了。 
				obj.src="rand.action?d="+timenow; 
			} 
			function changeCodeImg(){
				var img = document.getElementById("randImg"); 
				var timenow = new Date().getTime(); 
				img.src = "rand.action?d="+timenow; 
			}
	</script>
	<script type="text/javascript">
	var userID_OK = false;
	var password_OK = false;
	var code_OK = false;
	
	function checkUserID(u){
		var userID = u.value;
		if(userID!=null&&userID.length>0){
			userID_OK = true;
		}else{
			userID_OK = false;
		}
	}
	
	function checkPassword(pw){
		var password = pw.value;
		if(password!=null&&password.length>0){
			password_OK = true;
		}else{
			password_OK = false;
		}
	}
	
	function checkCode(c){ 
		var code = c.value;
		if(code!=null&&code.length>0){
			code_OK = true;
		}else{
			code_OK = false;
		}
	}
	
	function check(){
		var userID = document.getElementById("userID");
		var password = document.getElementById("password");
		var checkcode = document.getElementById("checkcode");
		checkUserID(userID);
		checkPassword(password);
		checkCode(checkcode);
		
		if(!userID_OK){
			alert("请输入用户名");
			document.getElementById("userID").focus();
			return false;
		}
		if(!password_OK){	
			alert("请输入用户密码");
			document.getElementById("password").focus();
			return false;
		}
		if(!code_OK){	
			alert("请输入验证码");
			document.getElementById("checkcode").focus();
			return false;
		}
	}
	</script> 
  <body>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="147" background="../images/top02.gif">
    	<img src="../images/login_admin.gif" width="1000px" height="147px" />
    </td>
  </tr>
</table>
    <table width="562" border="0" align="center" cellpadding="0" cellspacing="0" class="right-table03">
  <tr>
    <td width="221"><table width="95%" border="0" cellpadding="0" cellspacing="0" class="login-text01">
      
      <tr>
        <td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="login-text01">
          <tr>
            <td align="center"><img src="../images/ico13.gif" width="107" height="97" /></td>
          </tr>
          <tr>
            <td height="40" align="center">&nbsp;</td>
          </tr>
          
        </table></td>
        <td><img src="../images/line01.gif" width="5" height="292" /></td>
      </tr>
    </table></td>
    <td>
    	<form action="login_AdminUser.action" id="loginForm" method="post" onsubmit="return check();">
		 	
		 	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		 		<tr >
		 			<td colspan="2"  class="error">
		 				    <div id="errorInfo">
					          		<s:actionerror />
					          </div>
		 			</td>
		 		</tr>
				<tr>
				  <td width="31%" height="35" class="login_bean" >用户名/ID：<br /></td>
				  <td width="69%"><input class="login_text" name="user.userID"  id="userID" value="${user.userID }" type="text" size="30"  onblur="checkUserID(this)"/></td>
				</tr>
				<tr>
				  <td height="35" class="login_bean" >登录密码：<br /></td>
				  <td><input class="login_text" name="user.password" id="password" type="password" value="" size="30" onblur="checkPassword(this)"/></td>
				</tr>
				<tr>
				  <td height="35" class="login_bean"  >输入验证码：<br /></td>
				  <td>
				  		<input class="login_code"  name="checkcode"  id="checkcode"   type="text" size="6" maxlength="6" onfocus="" onblur="checkCode(this)"/>
	 	                <img src="rand.action" id="randImg" title="点击图片刷新验证码" onclick="changeValidateCode(this)" />
				   		<a href="javascript:" onclick="changeCodeImg();return false;" class="verify_code" title="点击更换图片"  style="text-decoration: none">看不清？</a></td>
				</tr> 
				<tr>
				  <td height="35">&nbsp;</td>
				  <td>
				  <input name="Submit2" type="submit" class="login_button" value="确认登录" onclick="return check();" />
				  <input name="Submit232" type="reset" class="reset_button" value="重 置" />
				  <input name="go_home" type="button" class="reset_button" value="首 页"  onclick="window.location='../index.jsp'"/>
				  </td> 
				  </tr>
    		</table>
    	</form>
    </td>
  </tr>
</table>
  </body>
</html>
